Class BooleanExpression

java.lang.Object
edu.uky.ai.lp.logic.BooleanExpression
All Implemented Interfaces:
Expression, Formula
Direct Known Subclasses:
NAryBooleanExpression, Negation

public abstract class BooleanExpression
extends java.lang.Object
implements Expression
The superclass of all Boolean logical expressions.
Author:
Stephen G. Ware
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Expression[] arguments
    The arguments to which the operator applies
    java.lang.String operator
    The name of the logical operator
  • Constructor Summary

    Constructors 
    Constructor Description
    BooleanExpression​(java.lang.String operator, Expression[] arguments)
    Constructs a new Boolean expression with the given operator and arguments.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object other)  
    int hashCode()  
    protected Expression[] substituteArguments​(Unifier unifier)
    Returns the expression's arguments with their variables substituted.
    protected java.lang.String toString​(java.lang.String separator)
    Given a separator character, this method returns a string representation of this expression with its argument separated.
    Unifier unify​(Formula other, Unifier unifier)
    Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.uky.ai.lp.logic.Expression

    substitute
  • Field Details

    • operator

      public final java.lang.String operator
      The name of the logical operator
    • arguments

      protected final Expression[] arguments
      The arguments to which the operator applies
  • Constructor Details

    • BooleanExpression

      public BooleanExpression​(java.lang.String operator, Expression[] arguments)
      Constructs a new Boolean expression with the given operator and arguments.
      Parameters:
      operator - the Boolean operator to be used
      arguments - the argument to which the operator applies
  • Method Details

    • equals

      public boolean equals​(java.lang.Object other)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      protected java.lang.String toString​(java.lang.String separator)
      Given a separator character, this method returns a string representation of this expression with its argument separated.
      Parameters:
      separator - the separator character
      Returns:
      a string
    • unify

      public Unifier unify​(Formula other, Unifier unifier)
      Description copied from interface: Formula
      Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same. The unifier passed in as an argument will not be modified; the (possibly extended) unifier is be returned by this method.
      Specified by:
      unify in interface Formula
      Parameters:
      other - the other logical formula to unify with
      unifier - the unifier to extend
      Returns:
      the new unifier that makes the two formulas the same, or null if they cannot unify
    • substituteArguments

      protected Expression[] substituteArguments​(Unifier unifier)
      Returns the expression's arguments with their variables substituted.
      Parameters:
      unifier - the unifier
      Returns:
      this expression's arguments, with variables substituted